<style>
    .layui-table-body .layui-table-cell {
        height: 100px;
        line-height: 100px;
    }
    .layui-table img {
        max-width: 150px;
    }
</style>
<div class="fsh-rightPanel">
    <label> <input type="password" style="display: none"></label>
    <div class="layui-anim layui-anim-upbit">
        <div class="layui-form-item wx-search" id="list_form">
            <div class="layui-inline">
                <input type="text" name="nickname" placeholder="请输入老师名称" autocomplete="off" class="layui-input">
            </div>
            <button class="layui-btn btn-primary" id="search">搜索</button>
        </div>
        <table id="teacherTable" class="layui-hide" lay-filter="teacherTable"></table>
    </div>
</div>
<script>


    layui.use(['layer', 'table'], function () {
        var layer = layui.layer;
        var table = layui.table;
        var tableObj = table.render({
            elem: '#teacherTable',
            request: {
                limitName: 'pageSize' //每页数据量的参数名，默认：limit
            },
            align: 'center'
            , cols: [[ //表头
                {type: 'checkbox', fixed: 'left'},
                {
                    field: 'photo', title: '头像', align: 'center', templet: function (d) {
                        return d.photo !== undefined ? '<div><img src="" style="height:100px;width:100px;" alt=""></div>' : '';
                    }
                },
                {field: 'username', title: '老师名称', align: 'center'},
                {
                    field: 'sex', title: '性别', align: 'center', templet: function (d) {
                        return d.sex === 0 ? '男' : '女';
                    },
                },
                {field: 'job', title: '所在学校', align: 'center'},
                {field: 'email', title: '邮箱', align: 'center'},
                {field: 'joinTime', title: '创建时间', align: 'center'},
            ]]
            , data: [{
                 "username": "李老师"
                , "email": "622222225@qq.com"
                , "sex": 0
                , "photo":""
                , "job": "北京大学"
                , "joinTime": "2016-10-14"
            }, {
                "username": "王老师"
                , "email": "622222225@qq.com"
                , "sex": 1
                , "photo":""
                , "job": "北京大学"
                , "joinTime": "2016-10-14"
            }, {
                "username": "张老师"
                , "email": "622222225@qq.com"
                , "sex": 0
                , "photo":""
                , "job": "清华大学"
                , "joinTime": "2016-10-14"
            }]
            , page: true

        });

        // 检索
        $("#search").click(function () {
            reloadTable(tableObj);
        });

    });
</script>
